require File.dirname(__FILE__)+'/../vendor/hikidoc/lib/hikidoc'

# patch HikiDoc to add without tag escape mode
class HikiDoc
  class HTMLOutputWithoutTagEscape < HTMLOutput
    def text(str)
      str
    end
  end
  def self.to_xhtml_without_tag_escape(src, options={})
    new(HTMLOutputWithoutTagEscape.new(" />"), options).compile(src)
  end
end

class HikiFilter < TextFilter
  description_file File.dirname(__FILE__) + "/../TextFormattingRules.html"

  def filter(text)
    HikiDoc.to_xhtml(text, :use_wiki_name => false)
  end
end

class HikiWithoutTagEscapeFilter < TextFilter
  filter_name "HikiWithoutTagEscape"
  description_file File.dirname(__FILE__) + "/../TextFormattingRules.html"

  def filter(text)
    HikiDoc.to_xhtml_without_tag_escape(text, :use_wiki_name => false)
  end
end
